package com.briup.smartlabs.web.controller;


import com.briup.smartlabs.bean.SStu;
import com.briup.smartlabs.utils.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {


    @RequestMapping("/hello")
    public void hello(){
        System.out.println("hello");
    }
    @RequestMapping("/test1")
    public Result<String> test1(){
        return Result.success("hello");
    }
    @RequestMapping("/test2")
    public Result<SStu> test2(){
        SStu sStu=new SStu();
        sStu.setSno(1L);
        sStu.setAge(20);
        sStu.setName("张三");
        sStu.setGender("男");
        return Result.success(sStu);
    }
    @RequestMapping("/test3")
    public Result<List<SStu>> test3(){
        SStu sStu1=new SStu();
        sStu1.setSno(1L);
        sStu1.setAge(20);
        sStu1.setName("张三");
        sStu1.setGender("男");
        SStu sStu2=new SStu();
        sStu2.setSno(2L);
        sStu2.setAge(20);
        sStu2.setName("张三a");
        sStu2.setGender("男");
        SStu sStu3=new SStu();
        sStu3.setSno(3L);
        sStu3.setAge(20);
        sStu3.setName("张三s");
        sStu3.setGender("男");
        List<SStu> list = new ArrayList<>();
        list.add(sStu1);
        list.add(sStu2);
        list.add(sStu3);
        return Result.success(list);
    }
}